package cn.zjh.base.config;

import cn.zjh.base.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 登录拦截相关配置
 */
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    /**
    * @Title: addInterceptors
    * @Description: 添加拦截器配置方法
    * @Author: Mr.Zhang
    * @Version: 1.0
    * @Date:  2022/7/9 19:46
    * @Parameters:
    * @Return
    */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/user/register/**")
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/fastDfs/**")
                .excludePathPatterns("/shop/settlement");
    }
}
